using System;
using System.Collections.Generic;
using System.Text;
using AF_ORM.CORE;
using Bussiness.Entity;
using System.Data;
namespace Bussiness.Manager
{
                

    public class PT_HondaModelManager:Bussiness.ManagerBase.PT_HondaModelManagerBase
    {
            public static PT_HondaModelManager CreateInstant()
            {
                return new PT_HondaModelManager();
            }
            public PT_HondaModelEntity GetByModelCode(string ModelCode)
            {
                List<PT_HondaModelEntity> lst = SelectByModelCodeLST(ModelCode);
                if (lst != null && lst.Count > 0)
                    return lst[0];
                return null;
            }
            public DataTable GetAll()
            { 
                string sql = @" Select m.*,g.GroupName 
                                from PT_HondaModel m LEFT JOIN PT_HondaModelGroup g ON m.GroupCode=g.GroupCode AND g.Isdeleted=0 
                                where m.IsDeleted=0
                                Order By m.OrderIndex";
                return SqlHelper.ExecuteDataTable(Config.ConnectionConfig.ConnectionString, CommandType.Text, sql);
            }
            public List<PT_HondaModelEntity> GetAll2()
            {
                AF_ORM.CORE.SelectOptions option = new AF_ORM.CORE.SelectOptions();
                option.AddSortField("OrderIndex", true);
                List<PT_HondaModelEntity> lst = PT_HondaModelManager.CreateInstant().SelectByIsActiveLST(true,option);
                for(int i=0;i<lst.Count;i++)
                {
                    if (lst[i].IsDeleted == true)
                        lst.Remove(lst[i]);
                }
                return lst;
            }
            public DataTable GetAll_Active()
            {
                string sql = " Select * from PT_HondaModel Where isDeleted = 0 AND isActive=1 Order By OrderIndex";
                return SqlHelper.ExecuteDataTable(Config.ConnectionConfig.ConnectionString, CommandType.Text, sql);
            }
    }
}
                    
